package com.minelx.sqlstructures.core.table;

import com.alibaba.fastjson.JSONArray;
import com.minelx.sqlstructures.core.values.FieldValues;
import com.minelx.sqlstructures.statements.Query;

import java.util.ArrayList;
import java.util.List;

public class SimpleTable implements ITable {
	private final List<FieldValues> fields;

	public SimpleTable() {
		fields = new ArrayList<>();
	}

	@Override
	public List<FieldValues> getFields() {
		return fields;
	}

	@Override
	public String getName() {
		// FIXME 2021/6/29  NOT IMPLEMENTED YET
		throw new RuntimeException("SimpleTable.name(...) haven't implemented yet");
	}

	public void addField(FieldValues added) {
		fields.add(added);
	}

	@Override
	public void clear() {
		throw new UnsupportedOperationException("ITable.clear is not supported.");
	}

	@Override
	public JSONArray toJSON(Query query) {
		throw new UnsupportedOperationException("SimpleTable.toJSON2 is not implemented yet.");
	}

	@Override
	public void attach(JSONArray lines) {
		throw new UnsupportedOperationException("SimpleTable.attach is not implemented yet.");
	}

	@Override
	public FieldValues primary() {
		throw new UnsupportedOperationException("SimpleTable.primary is not implemented yet.");
	}
}
